﻿using System;
using System.Text;

namespace HslCommunication.Core.IMessage
{
	/// <summary>
	/// OpenProtocol协议的消息
	/// </summary>
	// Token: 0x02000161 RID: 353
	public class OpenProtocolMessage : INetMessage
	{
		/// <inheritdoc cref="P:HslCommunication.Core.IMessage.INetMessage.ProtocolHeadBytesLength" />
		// Token: 0x17000604 RID: 1540
		// (get) Token: 0x06001DA6 RID: 7590 RVA: 0x0008D47D File Offset: 0x0008B67D
		public int ProtocolHeadBytesLength
		{
			get
			{
				return 4;
			}
		}

		/// <inheritdoc cref="M:HslCommunication.Core.IMessage.INetMessage.CheckHeadBytesLegal(System.Byte[])" />
		// Token: 0x06001DA7 RID: 7591 RVA: 0x0008DB8C File Offset: 0x0008BD8C
		public bool CheckHeadBytesLegal(byte[] token)
		{
			bool flag = this.HeadBytes == null;
			return !flag;
		}

		/// <inheritdoc cref="M:HslCommunication.Core.IMessage.INetMessage.GetContentLengthByHeadBytes" />
		// Token: 0x06001DA8 RID: 7592 RVA: 0x0008DBB0 File Offset: 0x0008BDB0
		public int GetContentLengthByHeadBytes()
		{
			byte[] headBytes = this.HeadBytes;
			bool flag = headBytes != null && headBytes.Length >= 4;
			int result;
			if (flag)
			{
				result = Convert.ToInt32(Encoding.ASCII.GetString(this.HeadBytes, 0, 4)) - 4;
			}
			else
			{
				result = 0;
			}
			return result;
		}

		/// <inheritdoc cref="M:HslCommunication.Core.IMessage.INetMessage.GetHeadBytesIdentity" />
		// Token: 0x06001DA9 RID: 7593 RVA: 0x00047BE1 File Offset: 0x00045DE1
		public int GetHeadBytesIdentity()
		{
			return 0;
		}

		/// <inheritdoc cref="P:HslCommunication.Core.IMessage.INetMessage.SendBytes" />
		// Token: 0x17000605 RID: 1541
		// (get) Token: 0x06001DAA RID: 7594 RVA: 0x0008DBF8 File Offset: 0x0008BDF8
		// (set) Token: 0x06001DAB RID: 7595 RVA: 0x0008DC00 File Offset: 0x0008BE00
		public byte[] SendBytes { get; set; }

		/// <inheritdoc cref="P:HslCommunication.Core.IMessage.INetMessage.HeadBytes" />
		// Token: 0x17000606 RID: 1542
		// (get) Token: 0x06001DAC RID: 7596 RVA: 0x0008DC09 File Offset: 0x0008BE09
		// (set) Token: 0x06001DAD RID: 7597 RVA: 0x0008DC11 File Offset: 0x0008BE11
		public byte[] HeadBytes { get; set; }

		/// <inheritdoc cref="P:HslCommunication.Core.IMessage.INetMessage.ContentBytes" />
		// Token: 0x17000607 RID: 1543
		// (get) Token: 0x06001DAE RID: 7598 RVA: 0x0008DC1A File Offset: 0x0008BE1A
		// (set) Token: 0x06001DAF RID: 7599 RVA: 0x0008DC22 File Offset: 0x0008BE22
		public byte[] ContentBytes { get; set; }
	}
}
